<?php
class Tab extends Element {
	private $headers = "" ;
	private $body = "" ;
	public function __construct( $headers = array() , $body = "" ){
		parent::__construct( "div" );
		$this->setAttribute( array( "class" => "fsi_tab" ) );
		$this->setHeader( $headers );
		$this->setBody( $body );
	}
	public function setHeader( $headers = "" ){
		if ( is_array( $headers ) && !empty( $headers ) ){
			foreach ( $headers AS $headerTitle ){
				$header = new HTMLElement("div");
				$header -> setValue( $headerTitle );
				$this->headers[] = $header;
			}
		}
	}
	public function setBody( $body = "" ){
		$this->body = new HTMLElement("div") ;
		$this->body->setValue( "Body value" );
	}
	public function getHeader(){
		return $this->headers;
	}
	public function getBody(){
		return $this->body;
	}
	public function getElement(){
		$headers = "" ;
		foreach( $this->headers AS $header ){
			$header->setAttribute( array("class" => "fsi_tab_header" ) );
			$headers .= $header->getElement()  ;
		}
		$headerHolder = new HTMLELement("div");
		$headerHolder -> setAttribute( array( "class" => "fsi_tab_header_board" ) );
		$headerHolder->setValue( $headers );
		
		$this->body->setAttribute( array( "class" => "fsi_tab_body" ) );
		parent::setValue ( $headerHolder->getElement() . $this->body->getElement() );
		return parent::getElement();
	}
}